*******************************************************************************
*** Generate patterns based on the spatial survey for the Wimpy, Williams and Whitten JoP piece.
***
*** Created: 4-17-17
*** Modified: 12-19-18
***
***
*******************************************************************************

insheet using "Spatial Census.csv", clear comma
drop ba - blah

*******************************************************************************
*** Patterns in the Spatial Survey
*******************************************************************************

*** Keep only those articles that use spatial models as their empirical tests.
keep if spatial == 1

*** Popularity of models
tab model1type

replace model1type = "Complex" if  model1type == "SAC" | model1type == "SDM" | model1type == "SAR and SDM"
replace model1type = "SLX" if substr(model1type, 1, 3) == "SLX"
replace model1type = "Other" if model1type == "Moran's I" | model1type == "SEM"
tab model1type

*** Local vs global
replace theoryglobal = "0" if theoryglobal == "." | theoryglobal == "see note"

tab theoryglobal
tab model1type if theoryglobal != "1"
tab model1type if theoryglobal == "1"
bys model1type: tab theoryglobal

*** Specification of W
tab multiple, miss
tab multiple if model1type == "SAR" | model1type == "SAR and SDM"
tab multiple if model1type != "SAR" | model1type != "SAR and SDM"

tab model1typeofwsummary
tab model1geographic

*** Interpretation
tab model1effectsnumbers if model1type == "SAR" | model1type == "SAR and SDM"
tab model1effectsgraphs if model1type == "SAR" | model1type == "SAR and SDM"
